import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GeoVO, GeoForm, GeoQuery } from '@/api/system/geo/types';

/**
 * 查询企业区域列表
 * @param query
 * @returns {*}
 */

export const listGeo = (query?: GeoQuery): AxiosPromise<GeoVO[]> => {
  return request({
    url: '/system/geo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询企业区域详细
 * @param id
 */
export const getGeo = (id: string | number): AxiosPromise<GeoVO> => {
  return request({
    url: '/system/geo/' + id,
    method: 'get'
  });
};

/**
 * 新增企业区域
 * @param data
 */
export const addGeo = (data: GeoForm) => {
  return request({
    url: '/system/geo',
    method: 'post',
    data: data
  });
};

/**
 * 修改企业区域
 * @param data
 */
export const updateGeo = (data: GeoForm) => {
  return request({
    url: '/system/geo',
    method: 'put',
    data: data
  });
};

/**
 * 删除企业区域
 * @param id
 */
export const delGeo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/geo/' + id,
    method: 'delete'
  });
};
